package cn.stylefeng.guns.core.util;

import cn.hutool.core.date.DateUtil;
import cn.stylefeng.roses.core.util.ToolUtil;

import java.util.Date;

public class ToolUtilExt {
    public ToolUtilExt(){

    }

    public static String dateFormat(Object o, String pattern){
        if(o instanceof Date){
            if(ToolUtil.isNotEmpty(pattern)){
                return DateUtil.format((Date) o,pattern);
            }else{
                return DateUtil.formatDate((Date)o);
            }
        }else{
            return o.toString();
        }

    }
}
